package models

import (
	"time"

	"go-admin/common/models"
)

type SysDevice struct {
	models.Model
	Name         string       `json:"name" gorm:"type:varchar(50);comment:设备名称"`
	DeviceId     string       `json:"deviceId" gorm:"type:varchar(50);comment:设备ID"`
	ParentId     string       `json:"parentId" gorm:"-"`
	DeptId       int          `json:"deptId" gorm:"type:bigint(20);comment:所属部门"`
	Manufacturer string       `json:"manufacturer" gorm:"type:varchar(255);comment:厂家"`
	DeviceType   string       `json:"deviceType" gorm:"type:varchar(255);comment:设备类型"`
	Firmware     string       `json:"firmware" gorm:"type:varchar(255);comment:固件版本"`
	DeviceModel  string       `json:"deviceModel" gorm:"type:varchar(255);comment:设备型号"`
	Status       int          `json:"status" gorm:"type:tinyint(1);comment:状态"`
	ActiveAt     time.Time    `json:"activeAt" gorm:"type:datetime;comment:活跃时间"`
	Dept         *SysDept     `json:"dept"`
	IsChannel    bool         `json:"isChannel" gorm:"-"`
	CID          int          `json:"cid" gorm:"-"`
	Children     []*SysDevice `json:"children,omitempty" gorm:"-"`
	models.ModelTime
	models.ControlBy
}

func (SysDevice) TableName() string {
	return "sys_device"
}

func (e *SysDevice) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *SysDevice) GetId() interface{} {
	return e.Id
}
